{include file="../include.tpl"}
<body>
{literal}
<style>
#ulList{list-style:none; padding:0; margin:0;width:97%;}
#ulList li{float:left;width:110px;height:140px;position: relative;}
#ulList li img{width:100px;height:90px; cursor:pointer;}
#ulList li div{position:absolute; top:100px;left:5px;}
.tblFile td{border:#CCC 1px solid}
#filelist div{height:30px; line-height:30px;}
.tblright td{padding:0;}
</style>

{/literal}
<iframe name="iframeSubmit" id="iframeSubmit" src="about:blank" style="display:none;"></iframe>
 

<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="17" height="29" valign="top" background="images/mail_leftbg.gif"><img src="images/left-top-right.gif" width="17" height="29" /></td>
    <td height="29" valign="top" background="images/content-bg.gif"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
      <tr>
        <td height="31"><div class="titlebt">素材信息</div></td>
      </tr>
    </table></td>
    <td width="16" valign="top" background="images/mail_rightbg.gif"><img src="images/nav-right-bg.gif" width="16" height="29" /></td>
  </tr>
  <tr>
    <td height="71" valign="middle" background="images/mail_leftbg.gif">&nbsp;</td>
    <td valign="top" bgcolor="#F7F8F9"><table width="100%" height="138" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="13" valign="top">&nbsp;</td>
      </tr>
      <tr>
        <td valign="top"><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td class="left_txt">当前位置：素材信息</td>
          </tr>
          <tr>
            <td height="20"><table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
              <tr>
                <td></td>
              </tr>
            </table></td>
          </tr>
 
          <tr>
            <td>
            <div id="users-contain" class="ui-widget" style="width:100%;">
	<form id="form" action="?act={$act}&op=saveInfo" method="post" target="iframeSubmit">
	<table id="users" class="ui-widget ui-widget-content">
		<tbody>
         <tr>
              <td align="left" valign="top" width="600">
                 <table width="100%">
                 <tr><td colspan="2" height="450" align="center" style="text-align:center" valign="middle">
                 <img src="{$f.path}" height="100%" width="100%"/></td></tr>
                 <tr><td>图片编号:{$f.fid}</td><td>上传:{$f.uname}</td></tr>
                 <tr><td>图片名称:<input type="text" name="dbmark" value="{$f.mark}" size="30"/></td><td rowspan="3">使用限制<br/><input type="text" value="{$f.limitUse}" name="dblimitUse" size="30"/></td></tr>
                 <tr><td>作者:<input type="text" name="dbauthor" value="{$f.author}" size="30"/></td></tr>
                 <tr><td>出处说明:<input type="text" name="dbinstro" value="{$f.instro}" size="30"/></td></tr>
                 </table> 
              </td>
              <td align="left" valign="top">
 				<table width="100%" class="tblright">
                 <tr><td align="left" valign="top">
                 <table width="100%" cellpadding="0" cellspacing="0">
                 <tr><td colspan="2">添加目录</td></tr>
                 <tr><td width="50">品牌</td><td><select id="brand" did="1" sel="{$f.brandId}" name="dbbrandId"></select></td></tr>
                 <tr><td>产品</td><td><select id="car" name="dbcarId" sel="{$f.carId}"></select></td></tr>
                 <tr><td>类型</td><td><select id="type" did="14" name="dbtypeId" sel="{$f.typeId}"></select></td></tr>
                 <tr><td>分类</td><td><select id="style" did="17" name="dbstyleId" sel="{$f.styleId}"></select></td></tr>
                 <tr><td>年份</td><td><select id="year" name="dbyear" sel="{$f.year}"></select></td></tr>
                 <input type="hidden" id="brandName" name="dbbrandName"/>
                 <input type="hidden" id="carName" name="dbcarName"/>
                 <input type="hidden" id="typeName" name="dbtypeName"/>
                 <input type="hidden" id="styleName" name="dbstyleName"/>
                 <input type="hidden" id="id" name="id" value="{$f.id}"/>
                 </table>
                 </td></tr>
                 <tr><td>
                 <table width="100%" cellpadding="0" cellspacing="0">
                 <tr><td >设置关键词</td></tr>
                 <tr><td>
                 <textarea name="dbkeywords">{$f.keywords}</textarea>
                 </td></tr>
                 
                 </table>
                 </td></tr>
                 <tr><td><table width="100%" cellpadding="0" cellspacing="0">
                 <tr><td >设置专题</td></tr>
                 <tr><td>
                 <textarea name="dbzhuanTi">{$f.zhuanTi}</textarea>
                 </td></tr>
                 
                 </table></td></tr>
                 <tr><td><table width="100%" cellpadding="0" cellspacing="0">
                 <tr><td >设置有效期限</td></tr>
                 <tr><td>
                  <input type="text" name="dbavaliDate" id="avaliDate" value="{$f.avaliDate}"/>
                 </td></tr>
                 
                 </table></td></tr>
                 <tr><td><button id="btnPost">完成发布</button></td></tr>
                 <tr><td><button id="btnUnPost">下架</button></td></tr>
                 </table> 
              </td>
         </tr>
		</tbody>
	</table>
    </form>
    <input type="hidden" id="act" value="{$act}"/>
</div>
 </td>
          </tr>
        </table>
          </td>
      </tr>
    </table></td>
    <td background="images/mail_rightbg.gif">&nbsp;</td>
  </tr>
  <tr>
    <td valign="middle" background="images/mail_leftbg.gif"><img src="images/buttom_left2.gif" width="17" height="17" /></td>
      <td height="17" valign="top" background="images/buttom_bgs.gif"><img src="images/buttom_bgs.gif" width="17" height="17" /></td>
    <td background="images/mail_rightbg.gif"><img src="images/buttom_right2.gif" width="16" height="17" /></td>
  </tr>
</table>
</body>
 {literal}
<script type="text/javascript">
// Custom example logic
$(function() {
		$( "input[type=submit], a, button" )
			.button()
			.click(function(event) {
			    var bid = $(event.target)[0].id;
	            
                if(bid=="btnPost")
			    {
			     	$("#form").submit();   
			    }
				else if(bid=="btnUnPost")
				{
					$.get("?act="+$("#act").val()+"&op=saveInfo&isPost=-1&id="+$("#id").val()+"&src=ajax",function(data){
						alert("下架成功");
						});
				}
				return false;
		});
 
		for(i=2013;i<new Date().getFullYear()+2;i++)
		{
			$("#year").append("<option>"+i+"</option>");
		}
        initSelect("brand",$("#brand").attr("did"));
		initSelect("type",$("#type").attr("did"));
		initSelect("style",$("#style").attr("did"));
	
		$("#car").html("<option value='0'>选择</option>");
		$("#brand").change(function(){
			$("#brandName").val($("#brand").find("option:selected").text());
		    initSelect("car",$("#brand").val());
		});
		$("#car").change(function(){
			$("#carName").val($("#car").find("option:selected").text());
		});
		$("#style").change(function(){
			$("#styleName").val($("#style").find("option:selected").text());
		});
		$("#type").change(function(){
			$("#typeName").val($("#type").find("option:selected").text());
		});
		$("#avaliDate").datepicker();
		
		
		if($("#year").attr("sel")!="")
		{
			$("#year").val($("#year").attr("sel"));
		}
});
function initSelect(obj,id)
{
	$.get("?act="+$("#act").val()+"&op=ajaxType&id="+id,function(data){
		var json = eval("("+data+")");		   
		if(json.length>0)
		{
			selop = "<option value='0'>选择</option>";
			for(i=0;i<json.length;i++)
			{
				selop = selop+"<option value='"+json[i].id+"'>"+json[i].name+"</option>";
			}
			//alert(id);
			$("#"+obj).html(selop);
		}
		if($("#"+obj).attr("sel")!="")
		{
			$("#"+obj).val($("#"+obj).attr("sel"));
			$("#"+obj).change();
		}
		
	});
}
function saveResult(st)
{
	if(st==1)
	{
		alert("发布成功");
	}
}
</script>
{/literal}
